﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.TextEditor;
using Pub;

namespace LZQXT.Test.Forms.Script
{
    public partial class FCS_Lib : Form
    {
        public RichTextBox tboxLib = new RichTextBox();
        public string sLib = "";

        public FCS_Lib()
        {
            InitializeComponent();
        }

        public void ShowDialog(ref string sLib)
        {
            setLib(sLib);

            ShowDialog();

            sLib = this.sLib;
        }

        private void FCS_Lib_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.sLib = this.sLib.Replace("\n", "");
        }

        public void setLib(string sLib)
        {
            this.sLib = sLib.Replace(";", ";\n");
            tboxLib.Text = this.sLib;
        }

        private void FCS_Lib_Load(object sender, EventArgs e)
        {
            panel2.Dock = DockStyle.Fill;

            tboxLib.Parent = panel2;
            tboxLib.BorderStyle = BorderStyle.Fixed3D;
            tboxLib.Dock = DockStyle.Fill;

            //CTextEditMenu textMenu1 = new CTextEditMenu(tboxLib);
            CRichTextBoxMenu textMenu2 = new CRichTextBoxMenu(tboxLib);
            //setLib(Program.fcs.tboxLib.Text);
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.sLib = tboxLib.Text.Replace("\n", "");
            //Program.fcs.tboxLib.Text = sLib;
            //CConfig.SaveConfigVal("cs_lib", sLib);
            Close();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "*.dll;*.exe|*.dll;*.exe";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string sFileName = openFileDialog1.FileName;
                if (tboxLib.Text.Length > 0) tboxLib.Text += ";\n";
                tboxLib.Text += sFileName;
            }
        }
    }
}
